package com.liehu.user;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import util.EncryptedDataUtils;
import util.HttpClientUtil;
import util.IdWorker;
import util.JwtUtil;

@SpringBootApplication
@EnableDiscoveryClient
@EnableEurekaClient
public class UserApplication {

	public static void main(String[] args) {
		SpringApplication.run(UserApplication.class, args);
	}

	/**
	 * 推特雪花id生成器
	 * @return
	 */
	@Bean
	public IdWorker idWorkker(){
		return new IdWorker(1, 1);
	}

	/**
	 * JWt令牌工具生成类
	 * @return
	 */
	@Bean
	public JwtUtil jwtUtil(){
		return  new JwtUtil();
	}

	/**
	 * SpringSecurity加盐加密
	 * @return BCryptPasswordEncoder
	 */
	@Bean
	public BCryptPasswordEncoder encoder(){
		return  new BCryptPasswordEncoder();
	}

	/**
	 * 	发起http网络请求的工具类
	 * @return
	 */
	@Bean
	public HttpClientUtil httpClientUtil(){
		return new HttpClientUtil();
	}

	/**
	 * 处理微信加密信息的工具类
	 * @return
	 */
	@Bean
	public EncryptedDataUtils encryptedDataUtils(){
		return  new EncryptedDataUtils();
	}
	
}
